home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / cpptut22.zip / CONCOM.CPP < prev    next >
C/C++ Source or Header  |  1992-01-20  |  1KB  |  38 lines

  1.                                         // Chapter 1 - Program 1
  2.  
  3. #include <iostream.h>       /* This is the stream definition file */
  4.  
  5. void print_it(const int data_value);
  6.  
  7. main()
  8. {
  9. const int START = 3;        // The value of START cannot be changed
  10. const int STOP = 9;         // The value of STOP cannot be changed
  11. volatile int CENTER = 6;    /* The value of CENTER may be changed
  12.                                  by something external to this
  13.                                  program.                          */
  14. int index;                  /* A normal C variable                 */
  15.  
  16.    for (index = START ; index < STOP ; index++)
  17.       print_it(index);
  18. }     /* End of program */
  19.  
  20.  
  21. void print_it(const int data_value)
  22. {
  23.    cout << "The value of the index is  " << data_value << "\n";
  24. }
  25.  
  26.  
  27.  
  28.  
  29. // Result of execution
  30. //
  31. // The value of the index is  3
  32. // The value of the index is  4
  33. // The value of the index is  5
  34. // The value of the index is  6
  35. // The value of the index is  7
  36. // The value of the index is  8
  37.  
  38.